<script setup>
import * as THREE from 'three';
//导入轨道控制器
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js'
//导入lil.gui
import { GUI } from 'three/examples/jsm/libs/lil-gui.module.min.js'
//场景
const scene = new THREE.Scene();
//相机
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
//渲染器
const renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);


//设置相机位置
camera.position.z = 5;
camera.position.y = 2;
camera.position.x = 2
camera.lookAt(0, 0, 0)

//添加坐标辅助器
const axesHelper = new THREE.AxesHelper(5);
scene.add(axesHelper);

//添加轨道控制器
const controls = new OrbitControls(camera, renderer.domElement);
//实例化objloader
const loader = new THREE.ObjectLoader()
loader.load('../src/assets/scene.json', function (group) {
    scene.add(group)
})

function animate() {
    controls.update()
    requestAnimationFrame(animate)
    renderer.render(scene, camera);
}
animate();
</script>
<template>

</template>
<style lang="scss" scoped></style>